<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>账户</title>
    <link rel="stylesheet" type="text/css" href="../css/main.css"/>
    <style type="text/css">
    		.account_item .apply_drewing_time{background: #ccc;color:#666;}
    		.account_item .apply_drewings{background: #ec6d65;color:#fff;}
    		.logout_btn{border:1px solid #ccc;background: #fff;padding:15px;margin-top:10px;color:#8B8A8A;overflow: hidden;}
    </style>
    
</head>
<body>
<div class="list_header">
	<h1 class="">账户</h1>
</div>
<div class="list_content">
	<div class="list_content_padded">
		<div class="account_item">
			<div class="total_income_title">总收入：</div>
			<div class="total_income_content"><span></span>元</div>
			<div class="list_money">
				<div class="td_collection">已收款: <span></span>元</div>
				<div class="td_not_collection">未收款: <span></span>元</div>
				<div class="td_receivables">下次提款时间: <span></span></div>
				<button id='apply_drewing' class="list_button apply_drewing_time apply_drewings">申请提款</button>
			</div>
			
		</div>
		<div class="logout_btn">
			<div class="">安全退出</div>
		</div>
	</div>
		<ul class="list_bottom_menu" >
			<li class="">
				<a href="../index.html" >
					<div class="index_menu_btn">
						<span class="btn btn_4"><img src="../images/writeOff_icon.png" class="img_1"/></span>
					</div>
					<div class="index_menu_text">核销</div>
				</a>
			</li>
			<li class="">
				<a href="order/sharecard.html">
					<div class="index_menu_btn">
						<span class="btn btn_5"><img src="../images/sharecard_icon.png" class="img_1"/></span>
					</div>
					<div class="index_menu_text">乐享卡</div>
				</a>
			</li>
			<li class="">
				<a href="order/order.html">
					<div class="index_menu_btn">
						<span class="btn btn_5"><img src="../images/order_icon.png" class="img_1"/></span>
					</div>
					<div class="index_menu_text">订单</div>
				</a>
			</li>
			<li class="current">
				<a href="javascript:void(0);">
					<div class="index_menu_btn">
						<span class="btn btn_6"><img src="../images/user_icon.png" class="img_1"/></span>
					</div>
					<div class="index_menu_text">账户</div>
				</a>
			</li>
		</ul>
</div>
    <script src="../js/mui.min.js"></script>
    <script src="order/jquery-1.9.1.min.js"></script>
    <script src="../js/jquery.cookie.js"></script>
    <script src="../js/boxy.js"></script>
    <script src="../js/apiPath.js"></script>
<script type="text/javascript" charset="utf-8">
 //mui初始化
			bindd();
			$(function(){
				$.ajax({
					url:"/ajax/call/vender_admin/balance_info",
					data:{
						
					},
					type:'post',
					success:function(data){
						if(data.errno){
							boxy("获取信息失败");
						}else{
							var res = data ;
							$(".total_income_content span").text(res.total_revenue);
							$(".td_collection span").text(res.receipt_money);
							$(".td_not_collection span").text(res.no_receipt_money);
							$(".td_receivables span").text(res.next_receipt_time);
							if($(".td_not_collection span").val() >0 ){
								$("#apply_drewing").hide();
								$(".td_receivables").show();
							}else{
								
								$("#apply_drewing").show();
								$(".td_receivables").hide();
							}
						}
					}
				});
			});
			$(".apply_drewings").bind("click",function(){
				if($(".td_not_collection span").html() == 0){
					boxy("可提款为0,暂时不能申请提款！！");
				}else{
					$.ajax({
						url:"/ajax/call/vender_admin/pay_notice",
						data:{
							
						},
						type:'post',
						success:function(data){
							if(data.errno){
								boxy("催款失败");
							}else{
								boxy("催款成功");
								$.cookie("pay_notice","shenqing", { expires: 1, path: '/' });
								bindd();
							}
						}
					});
				}
				
			});
			function bindd(){
				if($.cookie("pay_notice") == null){
					$("#apply_drewing").removeClass("apply_drewing_time");
				}else{
					$(".apply_drewings").unbind("click").addClass("apply_drewing_time").removeClass("apply_drewings");
					$(".apply_drewing_time").click(function(){
								boxy("每天只能申请1次，请勿重复提交！");
							})
				}
			}
			$(".logout_btn").click(function(){
				$.ajax({
					url:"/logout/index?format=json",
					data:{
						
					},
					type:'post',
					success:function(data){
						if(data.redirect_to == "/login") {
							window.location.href='/resource/page/venderapp/login.html';
						}else{
							window.location.reload();
						}
					}
				});
			});
</script>
</body>
</html>